package com.example.mobile2021606140lhq0406;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private ImageView imaLine;
    private Button button;

    private int[] Trun;
    private int TrunId=0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();


        Trun=new int[6];
        Trun[0]=R.drawable.line01_01;
        Trun[1]=R.drawable.line01_02;
        Trun[2]=R.drawable.line01_03;
        Trun[3]=R.drawable.line01_04;
        Trun[4]=R.drawable.line01_05;
        Trun[5]=R.drawable.line01_06;

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imaLine.setImageResource(Trun[TrunId+1]);
                TrunId+=1;
            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        imaLine = (ImageView) findViewById(R.id.ima_line);
        button = (Button) findViewById(R.id.button);
    }
}